<?php

namespace App\Http\Controllers\v1;


use App\Models\Area;
use App\Models\Family;
use App\Models\Project;
use App\Models\SmsCode;
use App\Models\Team;
use App\Models\User;
use App\Models\UserCollection;
use App\Models\UserMessage;
use App\Models\UserTeam;
use App\Models\Volunteer;
use App\Models\VolunteerGoodAt;
use EasyWeChat\Core\Exception;
use Illuminate\Http\Request;
use App\Libs\IdCard;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Validator;
use Hashids\Hashids;
use anlutro\LaravelSettings\Facade AS Setting;

class UserTeamController extends Controller
{

    public function index(Request $request)
    {
        $userInfo = User::where('type', 1)->where('token', $this->getToken())->first();

        $lists = UserTeam::with('team')->whereIn('verify_status', [1, 0])->where('user_id', $userInfo->id)->orderBy('id', 'desc')->get();

        $list = [];
        foreach($lists as $team)
        {

            $tmp = Team::format($team->team);
            $tmp['join_status'] = $team->verify_status;
            $list[] = $tmp;
        }

        $data['list'] = $list;
        $this->setData($data);

        return $this->response();
    }


}
